package cn.wolfcode.luowowo.article.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.HashMap;

/**
 * @author 猫教授
 * @date 2019/8/9 17:38
 */
@Getter
@Setter
@NoArgsConstructor
public class TravelQuery extends QueryObject {
    private Integer destId=-1;//游记关联的地点ID
    public static final HashMap<Integer,TravelCondition> TRAVELTIMEMAP=new HashMap<>();//出发时间映射集
    public static final HashMap<Integer,TravelCondition> PEREXPENDMAP=new HashMap<>();//人均话费映射集
    public static final HashMap<Integer,TravelCondition> DAYMAP=new HashMap<>();//出行天数映射集
    private int orderType=1;
    private int travelTimeType=-1;
    private int perExpendType=-1;
    private int dayType=-1;
    static {
        TRAVELTIMEMAP.put(-1,new TravelCondition(1,12));//默认查询全部
        TRAVELTIMEMAP.put(1,new TravelCondition(1,2));
        TRAVELTIMEMAP.put(2,new TravelCondition(3,4));
        TRAVELTIMEMAP.put(3,new TravelCondition(5,6));
        TRAVELTIMEMAP.put(4,new TravelCondition(7,8));
        TRAVELTIMEMAP.put(5,new TravelCondition(9,10));
        TRAVELTIMEMAP.put(6,new TravelCondition(11,12));

        PEREXPENDMAP.put(-1,new TravelCondition(0,Integer.MAX_VALUE));//默认查询全部
        PEREXPENDMAP.put(1,new TravelCondition(1,999));
        PEREXPENDMAP.put(2,new TravelCondition(1000,6000));
        PEREXPENDMAP.put(3,new TravelCondition(6000,20000));
        PEREXPENDMAP.put(4,new TravelCondition(20001,Integer.MAX_VALUE));

        DAYMAP.put(-1,new TravelCondition(0,Integer.MAX_VALUE));//默认查询全部
        DAYMAP.put(1,new TravelCondition(0,3));
        DAYMAP.put(2,new TravelCondition(4,7));
        DAYMAP.put(3,new TravelCondition(8,14));
        DAYMAP.put(4,new TravelCondition(15,Integer.MAX_VALUE));
    }
    public String getOrder(){
        if (orderType==1){
            return "releaseTime desc";
        }else {
            return "viewnum desc";
        }
    }
    public TravelCondition getTravelTime(){
       return TRAVELTIMEMAP.get(travelTimeType);
    }
    public TravelCondition getPerExpend(){
       return PEREXPENDMAP.get(perExpendType);
    }
    public TravelCondition getDay(){
       return DAYMAP.get(dayType);
    }






    //要查的用户ID
    private Long authorId;
    //后台审核用的排序规则
    private  String OrderBy;
    //游记的当前状态
    private Integer state=-1;//默认查询全部
    //设置是否公开
    private Boolean ispublic;



}
